home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / batch / tsbat36.zip / DAILY.BAT < prev    next >
DOS Batch File  |  1991-09-09  |  1KB  |  53 lines

  1. echo off
  2. echo.
  3. echo ┌───────────────────────────────────────────────────┐
  4. echo │ Run a program only once a day at boot time        │
  5. echo │ By Prof. Timo Salmi, ts@chyde.uwasa.fi,  9-Sep-91 │
  6. echo └───────────────────────────────────────────────────┘
  7.  
  8. if "%1"=="" goto _help
  9.  
  10. rem What date was this bacth last run
  11. if exist date1$$$ goto _date_now
  12. echo Not yet run today > date1$$$
  13.  
  14. :_date_now
  15. rem What is the current date
  16. echo.|date > date2$$$
  17.  
  18. rem Compare the last and the current date
  19. fc date2$$$ date1$$$ > tmp$$$
  20. type tmp$$$ | find /v "fc: no differences encountered" > diffe$$$
  21. del tmp$$$
  22. if exist doit$$$ del doit$$$
  23. copy diffe$$$ doit$$$ > nul
  24. del diffe$$$
  25.  
  26. rem Move the current date information to the last run date variable
  27. copy date2$$$ date1$$$ > nul
  28. del date2$$$
  29.  
  30. rem Don't run if the dates match
  31. if not exist doit$$$ goto _done
  32. del doit$$$
  33.  
  34. rem Make the call
  35. call %1 %2 %3 %4 %5 %6 %7 %8 %9
  36. goto _out
  37.  
  38. :_help
  39. echo.
  40. echo If you want to run a program only once a day when you reboot
  41. echo your computer, put
  42. echo.
  43. echo   CALL DAILY YourApplicationName [Param1] [Param2] [...]
  44. echo.
  45. echo in your autoexec.bat file.
  46. goto _out
  47.  
  48. :_done
  49. echo %0 has already been run today
  50.  
  51. :_out
  52. echo on
  53.